package com.cheyun.netsalev3.viewmodel

import android.content.Intent
import android.view.View
import com.cheyun.netsalev3.bean.ClueDetails
import com.cheyun.netsalev3.bean.Data
import com.cheyun.netsalev3.bean.EditClueParam
import com.cheyun.netsalev3.view.cluefollowup.ClueFollowUpActivity
import com.cheyun.netsalev3.view.defeatdetails.DefeatDetailsActivity
import java.io.Serializable

/**
 * @author Michael
 * @date  2018/12/21 - 14:05.
 */
class AddSuccessActivityViewModel(var data: EditClueParam, var clueDetails: ClueDetails,var come:String,var keliudata:Data?) : BaseViewModel() {
    /**
     * 点击完成
     */
    fun onClickComplete(view: View) {
//        var intent = Intent(view.context, MainActivity::class.java)
//        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
//        view.context.startActivity(intent)

        var intent = Intent(view.context,DefeatDetailsActivity::class.java)
        intent.putExtra("tid", clueDetails.tid)
        intent.putExtra("nkey", "archive.purge")
        intent.putExtra("come", come)
        view.context.startActivity(intent)
        myFinish()
    }

    /**
     * 点击跟进
     */
    fun onClickGenjin(view: View) {
        var intent = Intent(view.context, ClueFollowUpActivity::class.java)
        intent.putExtra("data", clueDetails as Serializable)
        intent.putExtra("leve", "")
        intent.putExtra("come", come)
        intent.putExtra("isNew", true)

        if(keliudata!=null){
            intent.putExtra("keliudata",keliudata!! as Serializable)
        }
        view.context.startActivity(intent)
        myFinish()
    }
}